1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.BoolFilter; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.Expression; 30 private import gtk.Filter; 31 private import gtk.c.functions; 32 public import gtk.c.types; 33 34 35 /** 36 * `GtkBoolFilter` evaluates a boolean `GtkExpression` 37 * to determine whether to include items. 38 */ 39 public class BoolFilter : Filter 40 { 41 /** the main Gtk struct */ 42 protected GtkBoolFilter* gtkBoolFilter; 43 44 /** Get the main Gtk struct */ 45 public GtkBoolFilter* getBoolFilterStruct(bool transferOwnership = false) 46 { 47 if (transferOwnership) 48 ownedRef = false; 49 return gtkBoolFilter; 50 } 51 52 /** the main Gtk struct as a void* */ 53 protected override void* getStruct() 54 { 55 return cast(void*)gtkBoolFilter; 56 } 57 58 /** 59 * Sets our main struct and passes it to the parent class. 60 */ 61 public this (GtkBoolFilter* gtkBoolFilter, bool ownedRef = false) 62 { 63 this.gtkBoolFilter = gtkBoolFilter; 64 super(cast(GtkFilter*)gtkBoolFilter, ownedRef); 65 } 66 67 68 /** */ 69 public static GType getType() 70 { 71 return gtk_bool_filter_get_type(); 72 } 73 74 /** 75 * Creates a new bool filter. 76 * 77 * Params: 78 * expression = The expression to evaluate 79 * 80 * Returns: a new `GtkBoolFilter` 81 * 82 * Throws: ConstructionException GTK+ fails to create the object. 83 */ 84 public this(Expression expression) 85 { 86 auto __p = gtk_bool_filter_new((expression is null) ? null : expression.getExpressionStruct(true)); 87 88 if(__p is null) 89 { 90 throw new ConstructionException("null returned by new"); 91 } 92 93 this(cast(GtkBoolFilter*) __p, true); 94 } 95 96 /** 97 * Gets the expression that the filter uses to evaluate if 98 * an item should be filtered. 99 * 100 * Returns: a `GtkExpression` 101 */ 102 public Expression getExpression() 103 { 104 auto __p = gtk_bool_filter_get_expression(gtkBoolFilter); 105 106 if(__p is null) 107 { 108 return null; 109 } 110 111 return ObjectG.getDObject!(Expression)(cast(GtkExpression*) __p); 112 } 113 114 /** 115 * Returns whether the filter inverts the expression. 116 * 117 * Returns: %TRUE if the filter inverts 118 */ 119 public bool getInvert() 120 { 121 return gtk_bool_filter_get_invert(gtkBoolFilter) != 0; 122 } 123 124 /** 125 * Sets the expression that the filter uses to check if items 126 * should be filtered. 127 * 128 * The expression must have a value type of %G_TYPE_BOOLEAN. 129 * 130 * Params: 131 * expression = a `GtkExpression` 132 */ 133 public void setExpression(Expression expression) 134 { 135 gtk_bool_filter_set_expression(gtkBoolFilter, (expression is null) ? null : expression.getExpressionStruct()); 136 } 137 138 /** 139 * Sets whether the filter should invert the expression. 140 * 141 * Params: 142 * invert = %TRUE to invert 143 */ 144 public void setInvert(bool invert) 145 { 146 gtk_bool_filter_set_invert(gtkBoolFilter, invert); 147 } 148 }